function writeAttrToFile (fileName, attr)
fid = fopen(fileName, 'w');
[~, tNum] = size (attr);
[~, len ] = size (attr{1});

for k = 1:tNum
    for j = 1:len
        for i = 1:len
            if ((j == 1) && (i == 1))
                fprintf (fid, '%d', attr{k}(i,j));
            else
                fprintf (fid, ',%d', attr{k}(i,j));
            end
        end
    end
    fprintf (fid, '\n');
end

fclose(fid);
